import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:xvideos/tools_base/widget/common_dialog.dart';

class NoPermissionDialog extends StatelessWidget {
  static Future show() {
    return Get.dialog(NoPermissionDialog(), barrierDismissible: false);
  }

  final String? msg;
  const NoPermissionDialog({Key? key, this.msg}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CommonDialog(
      child: SizedBox(
        width: 280,
        height: 180,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Text(
              "您已禁止权限，需要去设置页面手动开启才能继续使用",
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
              textAlign: TextAlign.center,
              style: TextStyle(
                fontSize: 16,
                height: 1.4,
                color: Color(0xff363636),
              ),
            ),
            Expanded(
              flex: 1,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.end,
                children: <Widget>[
                  Padding(
                    padding: const EdgeInsets.only(top: 30),
                    child: Row(
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: <Widget>[
                        Expanded(
                          flex: 1,
                          child: Container(
                            height: 40,
                            padding: const EdgeInsets.all(0),
                            alignment: Alignment.center,
                            decoration: const BoxDecoration(border: Border(top: BorderSide(color: Color(0xffD8D8D8), width: 1))),
                            child: InkWell(
                              child: Text(msg ?? "重试"),
                              onTap: () => Get.back(result: false),
                            ),
                          ),
                        ),
                        Expanded(
                          flex: 1,
                          child: Container(
                            height: 40,
                            alignment: Alignment.center,
                            decoration: const BoxDecoration(
                                border: Border(
                                    top: BorderSide(color: Color(0xffD8D8D8), width: 1),
                                    left: BorderSide(color: Color(0xffD8D8D8), width: 1))),
                            child: InkWell(
                              child: const Text(
                                "去设置",
                                style: TextStyle(color: Color(0xffFC3066)),
                              ),
                              onTap: () => Get.back(result: true),
                            ),
                          ),
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
